package com.lbj.mall.ware.dao;

import com.lbj.mall.common.entity.to.HasStockTo;
import com.lbj.mall.ware.entity.WareSkuEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 商品库存
 *
 * @author libingjun
 * @email 617416791@qq.com
 * @date 2022-03-27 12:13:54
 */
@Mapper
public interface WareSkuDao extends BaseMapper<WareSkuEntity> {

    HasStockTo hasStock(@Param("id") Long id);

    List<Long> listWareIdHasSkuStock(@Param("skuId") Long skuId);

    Long lockSkuStock(@Param("skuId") Long skuId, Long wareId, Integer num);

    void unLockStock(@Param("skuId") Long skuId, @Param("wareId") Long wareId, @Param("num") Integer num);
}
